﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Global Ajax Event Handlers</title>
</head>
<body>
    <div class="result"></div>
    <input type="button" id="ajaxBtn" value="Send Ajax Request" />
</body>
</html>
<script src="Scripts/jquery-2.1.4.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#ajaxBtn").click(function () {
            $(".result").load("test.html");
        });

        $(document).ajaxStart(function () {
            console.log('ajaxStart triggered');
        });

        $(document).ajaxSend(function () {
            console.log('ajaxSend triggered');
        });

        $(document).ajaxError(function () {
            console.log("ajaxError triggered.");
        });

        $(document).ajaxComplete(function () {
            console.log('ajaxComplete triggered');
        });

        $(document).ajaxStop(function () {
            console.log('ajaxStop triggered');
        });

        $(document).ajaxSuccess(function () {
            console.log('ajaxSuccess triggered');
        });
    });
</script>
